using System;
using System.Collections.Generic;

namespace WMS_Goodsinfo.Api.Write.DTOs
{
    /// <summary>
    /// 库存占比数据
    /// </summary>
    public class InventoryProportionData
    {
        public DateTime Timestamp { get; set; }
        public List<ProportionItem> QuantityData { get; set; } = new();
        public List<ProportionItem> AmountData { get; set; } = new();
        public decimal TotalQuantity { get; set; }
        public decimal TotalAmount { get; set; }
    }

    /// <summary>
    /// 占比项目
    /// </summary>
    public class ProportionItem
    {
        public string Name { get; set; }
        public decimal Value { get; set; }
        public string Color { get; set; }
    }

    /// <summary>
    /// 入库统计数据
    /// </summary>
    public class InboundStatisticsData
    {
        public DateTime Timestamp { get; set; }
        public string TimeRange { get; set; }
        public List<StatisticsItem> ChartData { get; set; } = new();
        public StatisticsSummary Summary { get; set; } = new();
    }

    /// <summary>
    /// 出库统计数据
    /// </summary>
    public class OutboundStatisticsData
    {
        public DateTime Timestamp { get; set; }
        public string TimeRange { get; set; }
        public List<StatisticsItem> ChartData { get; set; } = new();
        public StatisticsSummary Summary { get; set; } = new();
    }

    /// <summary>
    /// 统计项目
    /// </summary>
    public class StatisticsItem
    {
        public string Date { get; set; }
        public int Quantity { get; set; }
        public decimal Amount { get; set; }
        public int Count { get; set; }
    }

    /// <summary>
    /// 统计汇总
    /// </summary>
    public class StatisticsSummary
    {
        public int TotalQuantity { get; set; }
        public decimal TotalAmount { get; set; }
        public int TotalCount { get; set; }
        public decimal AvgQuantity { get; set; }
        public decimal AvgAmount { get; set; }
    }

    /// <summary>
    /// 排行榜数据
    /// </summary>
    public class RankingData
    {
        public DateTime Timestamp { get; set; }
        public List<RankingItem> InboundRanking { get; set; } = new();
        public List<RankingItem> OutboundRanking { get; set; } = new();
    }

    /// <summary>
    /// 排行项目
    /// </summary>
    public class RankingItem
    {
        public int Rank { get; set; }
        public int ProductId { get; set; }
        public string ProductName { get; set; }
        public int Quantity { get; set; }
        public decimal Amount { get; set; }
        public int Count { get; set; }
    }

    /// <summary>
    /// 系统消息
    /// </summary>
    public class SystemMessage
    {
        public string Id { get; set; } = Guid.NewGuid().ToString();
        public string Type { get; set; } // info, warning, error, success
        public string Title { get; set; }
        public string Content { get; set; }
        public DateTime Timestamp { get; set; }
        public bool AutoClose { get; set; } = true;
        public Dictionary<string, object> Data { get; set; } = new();
    }

    /// <summary>
    /// 完整仪表板数据
    /// </summary>
    public class DashboardData
    {
        public DateTime Timestamp { get; set; }
        public InventoryProportionData InventoryProportion { get; set; }
        public InboundStatisticsData InboundStatistics { get; set; }
        public OutboundStatisticsData OutboundStatistics { get; set; }
        public RankingData Ranking { get; set; }
        public List<SystemMessage> SystemMessages { get; set; } = new();
    }
}